{include file=header.html}
        <link href="{lib file=jquery.ui.1.10.2/css/ui-lightness/jquery-ui-1.10.2.custom.css}" rel="stylesheet">
       <script type="text/javascript" language="javascript" src="{lib file=jquery-1.6.3.min.js}"></script>
       <script language="javascript" type="text/javascript" src="{lib file=jquery.ui.1.10.2/js/jquery-ui-1.10.2.custom.js}"></script>

  		<script language="javascript" type="text/javascript" src="{res file=js/auto_textarea.js}"></script>
      <script language="javascript" type="text/javascript" src="{res file=js/fabric_info.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=ajaxfileupload.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
        <script language="JavaScript" type="text/javascript" src="{res file=js/lan.js}"></script>
        <link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
        <script language="javascript" type="text/javascript" src="{res file=js/select.js}"></script>
        <style>
            label.error {color:red;}
			.center {text-align:center;}
			tr.fabric_info_list td input{width:100%;height:100%;}
			.btn-2{margin-bottom:5px;}
			input{margin-right:5px;}
            .input-1 {line-height:18px;width:158px;}
			 .select-1 {line-height:18px;width:160px;}
			 .img_border{
				border: 2px solid #000000;width: 80px;height: 60px;
			}
			input {
				vertical-align: -5px;_vertical-align: -1px;margin-right: 5px
			}
        </style>
    </head>
<body>
<script type="text/javascript">
$(function() {
	$('#factory_id').change(function() {
		$('#factory_name').val($(this).children(':selected').html());
	});
	if ($('#factory_name').val() == '') {
		$('#factory_id').change();
	}
	$('select[select_input="select_input"]').each(function(i) {
		init_select_input($(this));
	});
	$('div.select-input').each(function(i) {
		$(this).css('z-index', $('div.select-input').length - i);
	});
	$('#add_fabric_info').click(function() {
		var tr = $('<tr><td colspan="3"></td><td colspan="3"></td><td></td></tr>');
		var sel_input = $($('#fabric_shop_data').html());
		sel_input.attr('select_input', 'select_input');
		sel_input.attr('name', 'new_fabric_info[][fabric_shop_id]');
		sel_input.attr('id', 'new_fabric_info[][fabric_shop_id]');
		sel_input.attr('class', 'input-3');
		var desc = $('<input type="text" class="input-3" name="new_fabric_info[][description]">');
		tr.find('td:eq(0)').append(desc);
		tr.find('td:eq(1)').append(init_select_input(sel_input));
		$('div.select-input').each(function(i) {
			$(this).css('z-index', $('div.select-input').length - i);
		});
		tr.css('background-color', '#F4F8FA');
		var add_fabric_shop = $('#add_fabric_shop');
		tr.insertAfter(add_fabric_shop.parents('tr'));
		if ($('input.btn-2[value="移除"]').length < 1) {
			add_fabric_shop.parent().append($('<input type="button" value="移除" class="btn-2" />'));
		}
		tr.find('td:eq(2)').append($('<input type="button" value="移除" class="btn-2" />'));
		tr.find('td:eq(2)').append(add_fabric_shop);
		sort_new_fabric_info();
	});

	$('#add_fabric_shop').click(function() {
		var value = $.trim(prompt("请输入布行/档口名称：", ''));
		if (value != '' && confirm('系统将增加此布行信息到系统，请确认是否重复。\r\n' + value + '\r\n确定要添加该布行吗？')) {
			$.post('index.php?app=fabric_shop&act=AjaxAdd', {'fabric_shop_name' : value}, function(json) {
				if (json.done) {
					ref_fabric_shop();
				}
				alert(json.msg);
			}, 'json');
		}
	});
	$('input[acttype="confirm"]').click(function() {
		if (confirm('是否已经保存信息？更新样板信息之后将会使已确认样板状态无效。\r\n\r\n是否继续？')) {
			$.getJSON('index.php?app=sample&act=confirm&id={$smarty.get.id}', function(json) {
				alert(json.msg);
			});
		}
	});
	<!--{if $order.confirm_date || $order.status == 5}-->
	$('[name^="new_fabric_info"]').attr('disabled', true);
	$('[name^="old_fabric_info"]').attr('disabled', true);
	$('input.input-3').attr('disabled', true);
	<!--{/if}-->
	/* 
	//如果存在主唛id就显示主唛图片
	var m_id=$('#main_label').val();
	if(m_id!=0){
		$.ajax({
			url: 'index.php?app=order&act=ajax_mian_label_img&m_id=' + m_id,
			type: 'GET',
			dataType:'json',
			error: function () {alert('网络连接错误，请稍后再试');},
			success: function (data) {
				if (data != '') {
					var str='';
					str += '<span><a href="download.php?id='+data.file_id+'" ><img src="'+data.file_path+'" title="'+data.file_name+'" width="150px" height="30px"></img></a></span>';
					$('#main_file').html(str);
				}
			}
		});
	}else{
		$('#main_file').html('');
	}
	
	//如果存在挂牌id就显示挂牌图片
	var l_id=$('#listing_code').val();
	if(l_id!=0){
		$.ajax({
			url: 'index.php?app=order&act=ajax_listing_img&l_id=' + l_id,
			type: 'GET',
			dataType:'json',
			error: function () {alert('网络连接错误，请稍后再试');},
			success: function (data) {
				if (data != '') {
					var str='';
					str += '<span><a href="download.php?id='+data.file_id+'" ><img src="'+data.file_path+'" title="'+data.file_name+'" width="150px" height="30px"></img></a></span>';
					$('#listing_file').html(str);
				}
			}
		});
	}else{
		$('#listing_file').html('');
	}*/
}); 

function sort_new_fabric_info()
{
	$('input[name^="new_fabric_info"][name$="[description]"]').each(function(i) {
		$(this).attr('name', 'new_fabric_info[' + i + '][description]');
	});
	$('input[name^="new_fabric_info"][name$="[fabric_shop_id]"]').each(function(i) {
		$(this).attr('name', 'new_fabric_info[' + i + '][fabric_shop_id]');
		$(this).attr('id', 'new_fabric_info[' + i + '][fabric_shop_id]');
	});
}

function remove_fabric_shop(_this)
{
	if (!confirm('确定要移除该面料信息吗？')) {
		return false;
	}
	$(_this).parent().parent().remove();
}

function get_sample(obj){
	var id=obj.value;
	if(!id) return;
	$.getJSON('index.php?app=order&act=getsample&ajax=1&id='+id,function(json){
		if(json.done){
			$('#arrival_date').attr('value',json.retval.arrival_date);
			if(json.retval.front_pic!=''){
				$('#front_pic').attr('value',json.retval.front_pic);
				$('#front_image').attr('src',json.retval.front_pic);
				$('#front_image').show();
			}
			if(json.retval.other_pic!=''){
				$('#back_image').attr('src',json.retval.other_pic);
				$('#back_pic').attr('value',json.retval.other_pic);
				$('#back_image').show();
			}
			$('#style_id').attr('value',json.retval.style_id);
			$('#special_id').attr('value',json.retval.special_id);
			$('#factory_id').attr('value',json.retval.factory_id);
			$('#fabric_id').attr('value',json.retval.fabric_id);
			$('#feature_id').attr('value',json.retval.feature_id);
			$('#factory_files').html('');
			var files = json.retval.factory_files;
			for (var key in files) {
				$('#factory_files').html($('#factory_files').html() + ($('#factory_files').html() == '' ? '' : '<br />'));
				$('#factory_files').html($('#factory_files').html() + '<a href="download.php?id=' + files[key].file_id + '">' + files[key].file_name + '</a><a class="pic_del" href="{url app=comupload&act=delete&id=}' + files[key].file_id + '" onClick="return confirm(\'{$lang.confirm_del_file}\')" title="{$lang.delete}">&nbsp;</a>');
			}
		}else{
			alert(json.msg);
		}
	});
}

function change_pic(id){
	$.funkyUI({url:"index.php?app=comupload&act=order_pics&id="+id,css:{width:"350",height:"250"}});
	return false;
}

//面料需求
function assign_merch_fabric(){
	var url="index.php?app=merchant&act=merch_fabric&order_id={$order.order_id}";
	location.href=url;
}

function confirm_order(id) {
	if(!confirm('确认代表工厂已经同意此订单页面内的所有信息，是否确认？')) {
		return false;
	}
	$.getJSON('index.php?app=order&act=update_status&status=2&ajax=1&id=' + id, function(json) {
		if(json.done) {
			location.href = location.href;
		} else {
			alert(json.msg);
		}
	});
}

//重置生产板
function reset_order_status(id){
	if(!confirm('您确定要重置此生产板吗？')) {
		return false;
	}
	$.getJSON( 'index.php?app=order&act=reset_order&ajax=1&id=' + id, function(json) {
		if(json.done) {
			location.href = location.href;
		} else {
			alert(json.msg);
		}
	});
}

function cancel_order(id){
	if(!confirm('取消后不可修改，确认？')) {
		return false;
	}
	$.getJSON( 'index.php?app=order&act=update_status&status=5&ajax=1&id=' + id, function(json) {
		if(json.done) {
			location.href = location.href;
		} else {
			alert(json.msg);
		}
	});
}
function chuhuo(id)
{
	if (confirm('确认已出货？')) {
		$.getJSON('index.php?app=order&act=update_status&status=3&ajax=1&id=' + id, function(json) {
			if (json.done) {
				location.href = location.href;
			} else {
				alert(json.msg);
			}
		});
	}
}

function addbuff()
{

	var buff=encodeURI($("#add_buff").val());
	if(buff!="")
	{
		var url="{$site_url}/index.php?app=order&act=addrecord&id={$order.order_id}&buff="+buff;
		$.getJSON(url,function(ret){
				if(ret.done)
				{
					$("#add_buff").val("");
					if($("#record_list p").size()>0)
					{
					$("#record_list p:first").before(ret.retval);
					}
					else
					{
					$("#record_list").append(ret.retval);
					}
				}
				else
				{
					alert(ret.msg);
				}
			
			});	
	}
}

function approve_no()
{
	
	if($("#approve_no_desc").val()=="")
	{
		$.funkyUI({url:"index.php?app=order&act=approve_not_pass",css:{width:"455",height:"330"}});
		return false;
	}
	return true;
}

//生产板进度
function product_update(_th){
	var btn_val=$(_th).val();
	$.ajax({
		url:'index.php?app=order&act=product_update&order_id='+"{$order.order_id}",
		type:'post',
		dataType:'json',
		data:$('#product_info input').serialize(),
		error:function(){
			alert('网络连接错误，请稍后再试');
		},
		success:function(data){
			if(data.flag){
				if(data.msg){
					alert(data.msg);
				}
				window.location = data.url;
			}else{
				alert(data.msg);
			}
		}
	});
}
</script>
<div id="fabric_shop_data" style="display:none;"><select><!--{foreach from=$fabricshop_list item=fabric_shop}--><option value="{$fabric_shop.fabric_shop_id}">{$fabric_shop.fabric_shop_name|escape}</option><!--{/foreach}--></select></div>
<div class="sub-body">
	<h3 class="title-1 tab-frame"><span>订单信息</span></h3>
    <div class="tab-frame" style="width:900px;">
		<form method="post">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
            	<th  align="right" width="120">下单日期：</th>
            	<td width="180">{$order.order_create_date|date}&nbsp;&nbsp;状态：{$lang.order_status.$order.status}</td>
            	<th colspan="2" width="300">正面</th>
            	<th colspan="2" width="300">反面</th>
            </tr>
			<tr>
            	<th  align="right">品牌：</th>
            	<td><select name="info[brand_id]" {if !$is_edit OR $order.status neq ORDER_STATUS_NO_CONFIRM} disabled{/if} id="brand_id" onChange="brand_change(this.value);" class="select-1" >
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$brand_list item=brand key=k}-->
					<option value="{$brand.brand_id}"{if $order.brand_id == $brand.brand_id} selected{/if}>{$brand.brand_name}&nbsp;&nbsp;({$brand.company_name|escape})</option>
					<!--{/foreach}-->
			  </select></td>
			  <td colspan="2" align="center" rowspan="11"><img id="front_image" width="220" height="264" src="{$order.front_pic}" alt=""></td>
            	<td colspan="2" align="center" rowspan="11"><img id="back_image" width="220" height="264" src="{$order.back_pic}" alt=""></td>
            </tr>

        	<tr>
            	<th  align="right">买手：</th>
            	<td>
                            <select name="info[buyer_id]" {if !$is_edit OR $order.status neq ORDER_STATUS_NO_CONFIRM} disabled{/if} id="buyer_id" class="select-1" onchange="buyer_change(this.value)">
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$buyer_list item=buyer key=k}-->
					<option value="{$buyer.user_id}"{if $order.buyer_id == $buyer.user_id} selected{/if}>{$buyer.user_name}</option>
					<!--{/foreach}-->
			  </select>
              </td>
            </tr>
           
			<tr>
            	<th  align="right">跟单：</th>
            	<td><select name="info[merchandiser_id]" {if !$is_edit OR $order.status neq ORDER_STATUS_NO_CONFIRM} disabled{/if} id="merchandiser_id" class="select-1" >
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$merchandiser_list item=merchandiser key=k}-->
					<option value="{$merchandiser.user_id}"{if $order.merchandiser_id == $merchandiser.user_id} selected{/if}>{$merchandiser.user_name}</option>
					<!--{/foreach}-->
			  </select></td>
            </tr>
        	<tr>
            	<th  align="right">订单号：</th>
            	<td><input type="text" class="input-1" name="info[order_sn]" id="order_sn" value="{$order.order_sn|escape}" {if !$is_edit OR $order.status neq ORDER_STATUS_NO_CONFIRM} disabled{/if} {if $is_power}disabled{/if} {if $factory_role}disabled{/if} /></td>
            </tr>
        	<tr>
            	<th  align="right">款号：</th>
            	<td><input type="text" class="input-1" name="info[style_sn]" id="style_sn" value="{$order.style_sn}" {if !$is_edit OR $order.status neq ORDER_STATUS_NO_CONFIRM} disabled{/if} {if $is_power}disabled{/if} {if $factory_role}disabled{/if} /></td>
            </tr>
        	<tr>
            	<th  align="right">参考板号：</th>
            	<td><select name="info[sample_id]" id="sample_id" class="select-1" onchange="get_sample(this)" {if !$is_edit OR $order.status neq ORDER_STATUS_NO_CONFIRM} disabled{/if} {if $is_power}disabled{/if} {if $factory_role}disabled{/if} />
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$sample_list item=sample key=k}-->
					<option value="{$sample.sample_id}"{if $order.sample_id == $sample.sample_id} selected{/if}>{$sample.sample_sn}</option>
					<!--{/foreach}-->
				</select></td>
            </tr>
        	<tr>
            	<th  align="right">到板日期：</th>
            	<td><input type="text" class="input-1" name="info[arrival_date]" id="arrival_date"  value="{$order.arrival_date|date}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" disabled="disabled" /></td>
            </tr>
        	<tr>
            	<th  align="right">款式：</th>
            	<td><select name="info[style_id]" id="style_id" class="select-1" disabled="disabled">
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$style_list item=style key=k}-->
					<option value="{$style.style_id}"{if $order.style_id == $style.style_id} selected{/if} {if $is_power}disabled{/if}>{$style.style_name}</option>
					<!--{/foreach}-->
				</select></td>
            </tr>
        	<tr>
            	<th  align="right">工厂：</th>
            	<td><select name="info[factory_id]" id="factory_id" class="select-1" disabled="disabled">
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$factory_list item=factory key=k}-->
					<option value="{$factory.factory_id}"{if $order.factory_id == $factory.factory_id} selected{/if}>{$factory.factory_name}</option>
					<!--{/foreach}-->
				</select><input type="hidden" name="info[factory_name]" id="factory_name" value="{$order.factory_name}" /></td>
            </tr>
        	<tr>
            	<th  align="right">运输：</th>
            	<td><select class="select-1" name="info[trans_type]" id="trans_type"  disabled="disabled">
                            <option value="0">海运</option>
                            <option value="1"{if $order.trans_type == 1} selected{/if}>空运</option>
                        </select></td>
            </tr>
            <tr>
            	<th  align="right">目的地：</th>
            	<td>{$order.brand_addr}</td>
            </tr>
			<tr>
            	<th  align="right">件数：</th>
            	<td><input type="text" class="input-1" name="info[quantity]" id="quantity" value="{$order.quantity}" disabled="disabled" /></td>
            	<td colspan="4" align="center"><input id="front_pic" type="hidden" name="info[front_pic]" value="{$order.front_pic}"><input id="back_pic" type="hidden" name="info[back_pic]" value="{$order.back_pic}"><input type="button"  onclick="change_pic('{$order.order_id}');" class="btn-3" disabled="disabled" value="更新图片"></td>
            </tr>
			<tr>
            	<th align="right">工厂价格：</th>
            	<td><!-- {if $user.role neq USER_QC} --><input type="text" size="16" name="info[factory_price]" id="factory_price" value="{$order.factory_price}" disabled="disabled" />元<!-- {/if} --></td>
				<th align="right">工厂入仓日期：</th>
				<td><input type="text" class="input-1" name="info[release_date]" id="release_date" value="{$order.release_date|date}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" disabled="disabled"/></td>   
		<th align="right">实际出货件数：</th>
		<td>
        {if $user.role eq USER_MERCHANDISER OR $user.role eq USER_MANAGER OR $user.role eq USER_FACTORY OR $user.role eq USER_FINANCE OR $user.role eq USER_CHUANWU OR $user.role eq USER_QC}
        <input type="text" class="input-1" name="info[ship_count]" id="ship_count" value="{$order.ship_count}" disabled="disabled" />
        {else}
        &nbsp;
        {/if}
        </td>

				</tr>
{if  $user.role neq USER_FACTORY}
			<tr>
            	<th  align="right">客人价格：</th>
            	<td>

            		<input type="text" size="16"  name="info[customer_price]" id="customer_price" value="{$order.customer_price}" disabled="disabled" />{$order.customer_price_name}
            		</td>
            	
            	<th align="right">客人入仓日期：</th>
            	<td>
                
                <input type="text" class="input-1" name="info[buyer_arrival_date]" id="buyer_arrival_date" value="{$order.buyer_arrival_date|date}"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" disabled="disabled"/>
			</td>

            	<th align="right">报价单：</th>
				<td id="factory_files"><!--{foreach from=$file_price item=file}--><a href="download.php?id={$file.file_id}">{$file.file_name}</a><!--{if !$smarty.foreach.last}--><br /><!--{/if}--><!--{/foreach}--></td>
            	</tr>
{/if}
{if $user.role eq USER_FINANCE}  
        	<tr>
            	<th align="right">应付金额：</th>
		<td>
        {if $user.role eq USER_FINANCE}
        <input type="text" class="input-1" name="info[dealwith_amount]" id="dealwith_amount" value="{$order.dealwith_amount}" disabled="disabled" />
        {else}
        &nbsp;
        {/if}</td>
				<th align="right">实际支付金额：</th>
		<td>{if $user.role eq USER_FINANCE}
        <input type="text" class="input-1" name="info[ship_amount]" id="ship_amount" value="{$order.ship_amount}" disabled="disabled"/>
        {else}
        &nbsp;
        {/if}</td>
				<th align="right">办公费用：</th>
		<td>{if $user.role eq USER_FINANCE}
        <input type="text" class="input-1" name="info[work_amount]" id="work_amount" value="{$order.work_amount}" disabled="disabled" />
        {else}
        &nbsp;
        {/if}
        </td>
            	</tr>
{/if}
		
		<tr>
            	<th align="right" >大货折扣： </th>
            	<td><a href="{url app=order&act=order_discount&id=$order.order_id}">查看</a></td>
            	<th align="right">商店退货：</th>
				<td>     
		        {if $user.role eq USER_CIVILIAN}
		                <a href="{url app=order&act=regoods_edit&order_id=$order.order_id}">编辑</a>
		        {else}
		           <a href="{url app=order&act=return_goods_view&order_id=$order.order_id}">查看</a>
		        {/if}</td>
				<th align="right">装箱单：</th>	 
				<td>
                {if $user.role eq USER_FACTORY}
                <a href="{url app=order&act=packedit&order_id=$order.order_id}">编辑</a>
                {else}
                  <a href="{url app=order&act=packedit&order_id=$order.order_id}">查看</a>
                {/if}</td>
			</tr>
             <tr>
            <!-- {if $user.role !=USER_FACTORY} -->
			    <th align="right">{$lang.detail_thumb}：</th>
			    <td align="left"><a href="{url app=order&act=upload_thumb&order_id=$order.order_id}">查看</a></td>
				<th align="right">{$lang.recomm_color}：</th>
			    <td align="left"><a href="{url app=order&act=recomm_view&order_id=$order.order_id}">查看</a></td>
			<!-- {/if} -->
				<th align="right">大货留底：</th>
				<td><input name="is_keep_sample" {if $user.role neq USER_CIVILIAN}disabled="disabled"{/if} value="0" type="radio" {if $order.is_keep_sample eq 0}checked=true{/if} />否&nbsp;&nbsp;&nbsp;&nbsp;<input name="is_keep_sample" value="1" type="radio" {if $order.is_keep_sample eq 1}checked=true{/if} {if $user.role neq USER_CIVILIAN}disabled="disabled"{/if} />是</td>
            </tr>

		<!-- {if $user.role==USER_CLIENT || $user.role==USER_MERCHANDISER || $user.role==USER_MANAGER || $user.role==USER_MERCHANDISER_ADMIN || $user.role==USER_FINANCE} -->
			<tr>
				<th rowspan="2" align="right">客户评语：</th>
				<td colspan="5"><textarea style="width:99%; height:50px;" name="info[consumer_comment_text]" readonly="readonly">{$order.consumer_comment_text}</textarea>
				</td>
			</tr>
          <tr>
				<td colspan="5">
           <div id="beizhu_files">
                <!--{foreach from=$file_comment item=file}-->
				<span><a href="download.php?id={$file.file_id}" >{$file.file_name}</a>
                </span>
				<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
                </div>
</td>
			</tr>
<tr>
				<th rowspan="2" align="right">客户备注：</th>
				<td colspan="5"><textarea style="width:99%; height:50px;" name="info[consumer_remarks_text]" readonly="readonly">{$order.consumer_remarks_text}</textarea>
</td>
			</tr>
          <tr>
				<td colspan="5">
           <div id="beizhu_files">
                <!--{foreach from=$file_remarks item=file}-->
				<span><a href="download.php?id={$file.file_id}" >{$file.file_name}</a>
                </span>
				<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
                </div>
</td>
			</tr>
			<!-- {/if} -->
		
			<tr>
				<th align="right" rowspan="2">批改意见：</th>
				<td colspan="5">
				<div id="product_info" style="display: inline;">
	                <!-- {if $order.product_status==1 && $user.role eq USER_FACTORY} -->
	                <input type="hidden" name="p_btn" value="工厂提交">
	                <input type="button" class="btn-1" value="工厂提交" name="product_sub" onclick="product_update(this)" />
	                &nbsp;&nbsp;&nbsp;&nbsp;
	                <!-- {/if} -->
	                <!-- {if $user.role eq USER_MANAGER || $user.role eq USER_MERCHANDISER || $user.role eq USER_MERCHANDISER_ADMIN} -->
	                <input type="button" class="btn-1" value="重置" onclick="reset_order_status({$order.order_id})" />
	                <!-- {/if} -->
	                <span><input type="radio" name="product_times" value="1" {if $order.product_times==1}checked{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px" disabled="disabled" />1板</span>&nbsp;&nbsp;
	                <span><input type="radio" name="product_times" value="2" {if $order.product_times==2}checked{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px" disabled="disabled" />2板</span>&nbsp;&nbsp;
	                <span><input type="radio" name="product_times" value="3" {if $order.product_times==3}checked{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px" disabled="disabled" />3板</span>&nbsp;&nbsp;
	                <span><input type="radio" name="product_times" value="4" {if $order.product_times==4}checked{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px" disabled="disabled" />4板</span>&nbsp;&nbsp;
	                <span><input type="radio" name="product_times" value="5" {if $order.product_times>4}checked{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px" disabled="disabled" />TOP板</span>
                </div>
                </td>
			</tr>
			<tr>
				<td colspan="5">
					<div id="file_pigai">
                	<!--{foreach from=$file_pigai item=file}-->
					<span><a href="download.php?id={$file.file_id}" >{$file.file_name}</a></span>
					<!--{if !$smarty.foreach.last}--><!--{/if}--> <!--{/foreach}-->
	                </div>
				</td>
			</tr>
			<tr>
				<th align="right" rowspan="4">制单资料：</th>
				<td rowspan="4">
             {if $ss_info}
                   {if $ss_info.ss_status eq SS_STATUS_SUCCESS}
                    	<a href="index.php?app=ss&ss_id={$ss_info.ss_id}" target="_blank" {if $factory_role}disabled{/if}>查看制单</a>
                   {/if}
                {/if}
                <div id="file_zhidan">
               <!--{foreach from=$file_zhidan item=file}-->
			   <span><a href="download.php?id={$file.file_id}">{$file.file_name}</a></span>
			   <!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
                </div>
                </td>
			</tr>
			<!-- <tr>
				<th align="right">主唛：</th>
				<td>
					<select name="main_label" id="main_label" style="width: 95%" onChange="main_label_change(this.value);" disabled="disabled">
						<option value="0">{$lang.select_pls}</option>
						{foreach from=$main_list item=mains}
						<option value="{$mains.m_id}" {if $mains.m_id==$order.m_id}selected{/if}>{$mains.main_code}</option>
						{/foreach}
			  		</select>
				</td>
				<th align="right">图片：</th>
				<td>
					<div id="main_file">
					</div>
				</td>
			</tr>
			<tr>
				<th align="right">挂牌：</th>
				<td>
					<select style="width: 95%" name="listing_code" id="listing_code" onChange="listing_code_change(this.value);">
						<option value="0">{$lang.select_pls}</option>
						{foreach from=$listing item=lists}
						<option value="{$lists.list_id}" {if $lists.list_id==$order.list_id}selected{/if}>{$lists.listing_code}</option>
						{/foreach}
			  		</select>
				</td>
				<th align="right">图片：</th>
				<td align="left">
					<div id="listing_file" style="width: 95%">
					</div>
				</td>
			</tr> -->
			<tr>
				<th align="right">小单备注：</th>
               <td colspan="3"><input name="info[small_order]" id="small_order" type="text" value="{$order.small_order}" style="width: 100%" /></td>
			</tr>
		    <tr>
		    	<th align="right">上传合同：</th>
		    	<td colspan="3">
		    		<!-- {if $user.role==USER_MANAGER || $user.role==USER_MERCHANDISER || $user.role==USER_FINANCE || $user.role==USER_MERCHANDISER_ADMIN || $user.role==USER_FACTORY} -->
	       			<div id="quote_contract_file" style="display: inline;">
	       				<!-- {foreach from=$order.contract_file item=file} -->
						<span><a href="download.php?id={$file.file_id}" style="color:blue">{$file.file_name}</a>
				        &nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
	       				<!-- {/foreach} -->
	       			</div>
	       			<!-- {/if} -->
		    	</td>
		    </tr>
			<tr>
				<th align="right">条码资料：</th>
				<td colspan="3">
                <div id="file_hetong" style="width:100%;display: inline;">
                <!--{foreach from=$file_hetong item=file}-->
				<span><a href="download.php?id={$file.file_id}">{$file.file_name}</a></span>
				<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
                </div>
                </td>
			</tr>
			
			<tr>
				<th align="right">生产板：</th>
				<td style="padding:1px;" colspan="5">{$order.production_board|nl2br}
				</td>
			</tr>
			<tr>
				<th align="right">大货布及辅料：</th>
				<td style="padding:1px;" colspan="5">
                {$order.large_cargo_cloth|nl2br}
				</td>
			</tr>
			<tr>
				<th align="right">船头板：</th>
				<td style="padding:1px;" colspan="5">{$order.bow_board|nl2br}</td>
			</tr>

    {if $user.role eq USER_MERCHANDISER || $user.role eq USER_MERCHANDISER_ADMIN || $user.role eq USER_MANAGER || $user.role eq USER_FINANCE}
         <tr>
				<th rowspan="2" align="right">备注：</th>
				<td style="padding:1px;" colspan="5"><textarea style="width:99%;height: 50px;overflow: hidden;" id="description" readonly="readonly" >{$order.description|nl2br}</textarea></td>
			</tr>
          <tr>
				<td colspan="5">
           <div id="beizhu_files">
                <!--{foreach from=$file_beizhu item=file}-->
				<span><a href="download.php?id={$file.file_id}" >{$file.file_name}</a>
                </span>
				<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
                </div>
</td>
			</tr>
   {/if}
		    <!-- <tr>
		    	<th align="right" style="font-size:12px;">{$lang.cut_bed_list}</th>
		    	<td colspan="9" style="margin: 0px;padding: 0px;">
		    	<table width="100%" class="cut_info_table" cellpadding="0" cellspacing="0">
			       <th width="20%" class="no_left_border">颜色</th>
			       <th width="10%">颜色描述</th>
			       <th width="10%">订单数</th>
			       <th width="10%">实际裁床数</th>
			       <th width="10%">误差率</th>
			      {foreach from=$cut_list item=cuts}
			       <tr class="cut_info_list center">
			       <td>
			       <input name="cb_id[]" type="hidden" value="{$cuts.cb_id}" />
			       <input name="colors[]" item="colors" type="hidden"  value="{$cuts.colors|escape}" />{$cuts.colors|escape}</td>
			       <td>
			       <input name="color_desc[]" item="color_desc" type="hidden"  value="{$cuts.color_desc}" />
			{$cuts.color_desc}</td> 
			       <td>
			       <input name="order_num[]" item="order_num" type="hidden"  value="{$cuts.order_num|default:0}" />
			{$cuts.order_num|default:0}</td>    
			       <td>
			       <input name="fact_num[]" item="fact_num" type="hidden"  value="{$cuts.fact_num|default:0}" />
			{$cuts.fact_num|default:0}
			</td>
			       <td>
			       <input name="error_num[]" item="error_num" type="hidden"  value="{$cuts.error_num|default:0}" />
			 {$cuts.error_num|default:0}</td>
			       </tr>
			       {foreachelse}
			       	<tr class="cut_info_list center">
			       		<td colspan="5">&nbsp;</td>
			       	</tr>
			       {/foreach}
			       </table>
	       			<div id="cut_order_file" style="margin: 5px 5px">
	       				{foreach from=$order.cut_file item=file}
						<span><a href="download.php?id={$file.file_id}" style="color:blue">{$file.file_name}</a>
				        &nbsp;&nbsp;{if !$smarty.foreach.last}</span>{/if}
	       				{/foreach}
	       			</div>
			       </td>
		    </tr>
		     -->
		    
            <tr>
		    	<th align="right" style="font-size:12px;">{$lang.qc_process_list}</th>
		    	<td colspan="9" style="margin: 0px;padding: 2px;">
		    	<table width="100%" class="process_receipt_table" cellpadding="0" cellspacing="0">
			       <th width="10%">查货日期</th>
			       <th width="48%">查货进度</th>
			       <th width="12%">附件</th>
			       <th width="12%">查货人</th>
			      <!--{foreach from=$process_list item=process}-->
			       <tr class="process_receipt_list center">
			       <td>
			       <input style="width: 100px" name="receipt_time" item="receipt_time" type="hidden"  value="{$process.receipt_time|date}" />{$process.receipt_time|date}</td>
			       <td>
			       <input style="width: 500px" name="process_content" item="process_content" type="hidden"  value="{$process.process_content|escape}" />
					{$process.process_content|escape}</td>    
			       <td><a href="{url app=order&act=process_upload&pid=$process.process_id}">附件</a></td>
			       <td>{$process.qc_name|escape}</td>
			       </tr>
			       <!-- {foreachelse} -->
			       <tr>
			       	<td colspan="4">&nbsp;</td>
			       </tr>
			       <!--{/foreach}-->
			       </table>
			       </td>
		    </tr>
            
			<tr>
				<th  align="right">进度记录：</th>
				<td colspan="5">
        <textarea style="width:70%;" id="add_buff" {if $user.role!=USER_FACTORY}readonly="readonly"{/if}></textarea>
        <input type="button" {if $user.role!=USER_FACTORY}disabled="disabled"{/if} class="btn-3" value="增加记录" onClick="addbuff();" /><br />
       <table  width="100%"><tr><td id="record_list" width="80%">
        {foreach from=$pro_records_list item=rec_item}
       <p>{$rec_item.rec_time|date:m-d}&nbsp:&nbsp{$rec_item.rec_buff}&nbsp&nbsp({$rec_item.rec_name})</p>
       {/foreach}
       </td>
       <td width="19%" class="center">
       		{if $user.role eq USER_CIVILIAN}
       		<input type="submit" class="btn-2" value="保存资料"><br />
       		{/if}
       		{if $order.status eq ORDER_STATUS_FACTORY_CONFIRM AND $user.role eq USER_FACTORY}
                   <input type="submit" onClick="if(confirm('确认代表工厂已经同意此订单页面内的所有信息，是否确认?')!=true){return false;}" name="submit" class="btn-2" value="确认订单"  /><br />
            {/if}
            <!-- {if $user.role eq USER_MERCHANDISER || $user.role eq USER_MANAGER} -->
            <input name="merchant_fabric" value="面料需求" type="button" class="btn-2" onclick="assign_merch_fabric()" />
            <!-- {/if} -->
            {if $user.role eq USER_MANAGER || $user.role eq USER_MERCHANDISER_ADMIN}
               <input type="submit" onClick="if(confirm('确定重置此订单吗?')!=true){return false;}" name="submit" class="btn-2" value="重置" /><br />
            {/if}
           <input type="button" class="btn-2" value="打印订单" onclick="window.open('{url app=order&act=order_print&id=$order.order_id}')" /><br />
           <input type="button" class="btn-2" value="返回" onclick="history.back();" /><br />
       </td>
       
       </tr></table></td>
			</tr>
		</table>
		</form>
	</div>
</div>
<script language="JavaScript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
<script type="text/javascript">
$(function(){
	var act="{$smarty.get.act}";
	var edit_work_amount=false;
	{if $user.role eq USER_FINANCE AND ($order.status eq ORDER_STATUS_APPROVE_FINANCE OR $order.status eq ORDER_STATUS_APPROVE)}
	edit_work_amount=true;
	{/if}

	$("input:visible[type='text']").each(function(index, element) {
		if($(this).attr("id")=="work_amount" && act!="order_print" &&edit_work_amount)
		{
			$(this).removeAttr("disabled");
		}
		else
		{
        $(this).after("<span>"+$(this).val()+"</span>");
		$(this).remove();
		}
    });
	if(act!="order_print")
	{
		$("input[value='上传附件']").not($("#qcreport_files,#disreason_files,#statement_file").prev()).remove();
		$("a.pic_del").not($("#qcreport_files,#statement_file").find("a.pic_del")).remove();
	}
	else
	{
		$("input[value='上传附件']").remove();
		$("a.pic_del").remove();
	}
		
	
	
	$("input[value='更新图片']").remove();
//	$("input[value='增加记录']").remove();
	$("select").each(function(index, element) {
		if($(this).attr("id")=="trans_type")
		{
		  $(this).after("<span>"+$(this).children("option:selected").html()+"</span>");
		  $(this).remove();
	 
		}
		else if($(this).attr("id")=="dis_reason")
		{
			return;
		}
		else
		{
		 $(this).next("div").remove();
		  if($(this).val()!=""&&$(this).val()!="0")
		  {
		  $(this).after("<span>"+$(this).children("option:selected").html()+"</span>");
		  }
		  $(this).remove();
		}
    });
//	$("textarea:visible:not(#add_buff,#approve_no_desc)").each(function(index, element) {
//		if($(this).val()=="")
//		{
//		$(this).remove();
//		}
//    });

	{if $user.role eq USER_QC}
		$("#record_list").next("td").children("input").not($("#record_list").next("td").children("input[value='打印订单'],input[value='返回'],input[value='确认订单'],input[value='审批通过'],input[value='审批不通过'],input[value='退货'],input[value='更新订单']")).remove();
	{else}
		$("#record_list").next("td").children("input").not($("#record_list").next("td").children("input[value='打印订单'],input[value='返回'],input[value='确认订单'],input[value='审批通过'],input[value='审批不通过'],input[value='退货'],input[value='重置'],input[value='保存资料']")).remove();
	{/if}

	$("#approve_no_desc").next("br").remove();

	if(act=="order_print")
	{
	  $("table:first tr:gt(14)").remove();
	  $("#record_list").next("td").children("input[value='打印订单'],input[value='返回']").remove();
	  window.print();	
	}
})

</script>
<script type="text/javascript"> 
//客户评语
var cc_text = document.getElementById("consumer_comment_text");
autoTextarea(cc_text);// 调用 

//客户备注
var cr_text = document.getElementById("consumer_remarks_text");
autoTextarea(cr_text);// 调用 

//备注
/* var description = document.getElementById("description");
autoTextarea(description);// 调用  */

//生产板
/* var p_board = document.getElementById("production_board");
autoTextarea(p_board);// 调用 

//大货布及辅料
var lcc = document.getElementById("large_cargo_cloth");
autoTextarea(lcc);// 调用 

//船头板
var bow_board = document.getElementById("bow_board");
autoTextarea(bow_board);// 调用  */
</script>
</body>
{$async_sendmail}
</html>